package web.beans;

import entity.User.bo.UserBo;
import entity.User.model.User;

/**
 * Created by vanches on 3.1.15.
 */
public class LoginBean {
    private String login;
    private String pass;
    private UserBean userBean;
    private UserBo userBo;


    public String doLogin(){

        User user=userBo.login(login, pass);
        if(user!=null){
            userBean.setInfo(user);
            return "index";
        }
        else{
            return "quest";
        }
    }
    // region Вход под User-ом и по Admin-ом
    public String doLoginUser(){

        User user=userBo.login("User", "user");
        if(user!=null){
            userBean.setInfo(user);
            return "index";
        }
        else{
            return "quest";
        }

    }
    public String doLoginAdmin(){
        User user=userBo.login("Vanches", "admin");
        if(user!=null){
            userBean.setInfo(user);
            return "index";
        }
        else{
            return "quest";
        }

    }
    //endregion ********************

    //region GET and SET

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public UserBo getUserBo() {
        return userBo;
    }

    public void setUserBo(UserBo userBo) {
        this.userBo = userBo;
    }

    //endregion

}
